home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / bluez.preinst < prev    next >
Text File  |  2008-10-26  |  2KB  |  55 lines

  1. #!/bin/sh
  2.  
  3. # snippet from http://www.dpkg.org/dpkg/ConffileHandling
  4.  
  5. # Prepare to move a conffile without triggering a dpkg question
  6. prep_mv_conffile() {
  7.     CONFFILE="$1"
  8.  
  9.     if [ -e "$CONFFILE" ]; then
  10.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  11.         old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
  12.         if [ "$md5sum" = "$old_md5sum" ]; then
  13.             rm -f "$CONFFILE"
  14.         fi
  15.     fi
  16. }
  17.  
  18. # Remove a no-longer used conffile
  19. rm_conffile() {
  20.     PKGNAME="$1"
  21.     CONFFILE="$2"
  22.     if [ -e "$CONFFILE" ]; then
  23.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  24.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
  25.         if [ "$md5sum" != "$old_md5sum" ]; then
  26.             echo "Obsolete conffile $CONFFILE has been modified by you."
  27.             echo "Saving as $CONFFILE.dpkg-bak ..."
  28.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  29.         else
  30.             echo "Removing obsolete conffile $CONFFILE ..."
  31.             rm -f "$CONFFILE"
  32.         fi
  33.     fi
  34. }
  35.  
  36. case "$1" in
  37. install|upgrade)
  38.     #if dpkg --compare-versions "$2" le "2.19-1"; then
  39.     #   prep_mv_conffile "/etc/init.d/bluez-utils"
  40.     #   prep_mv_conffile "/etc/default/bluez-utils"
  41.     #fi
  42.  
  43.     if dpkg --compare-versions "$2" le "3.7-1"; then
  44.         prep_mv_conffile "/etc/dbus-1/system.d/bluez-hcid.conf"
  45.     fi
  46.  
  47.     if dpkg --compare-versions "$2" le "3.30-1"; then
  48.         rm_conffile bluez-utils "/etc/bluetooth/network.service"
  49.         rm_conffile bluez-utils "/etc/bluetooth/serial.service"
  50.         rm_conffile bluez-utils "/etc/bluetooth/input.service"
  51.     fi
  52. esac
  53.  
  54.  
  55.